package com.wardrobe.soa.huanxin;

import io.swagger.client.model.RegisterUsers;
import io.swagger.client.model.User;


public class HuanXinUtil {

    public static void main(String[] args) throws Exception {
        User user = new User();
        user.setUsername("15838247979  ");
        user.setPassword("UUzO0EnCdpL/htKcf5OaRw+kA9UYnUJFMJAVuVpaF2F9f6pEd6jkX6pBxCyMTttpiwHIll0LaOZ9SQIlW22Ozg==");
//        System.out.println(registerHuanXin(user));
        System.out.println( registerHuanXin(user));
    }


    public static String registerHuanXin(User user) throws Exception {
        RegisterUsers users = new RegisterUsers();
        users.add(user);
        EasemobIMUsers ease = new EasemobIMUsers();
        String node = (String) ease.getIMUserByUserName(user.getUsername());
        //没有注册
        if (node==null){
            System.out.println(ease.createNewIMUserSingle(users));
            return "注册成功";
        }
        return "已经注册";
    }

    public static String addFriendSingle(String userName){
        EasemobIMUsers ease = new EasemobIMUsers();
        Object str = ease.addFriendSingle(userName, OrgInfo.SYSTEM_MANAGER);
        return str.toString();
    }

}